package app.service.impl;

import app.dao.EmployeeDao;
import app.pojo.Employee;
import app.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeDao employeeDao;

    @Override
    public List<Employee> listEmployee() {
        return employeeDao.listEmployee();
    }

    @Override
    public Employee queryById(Integer id) {
        return employeeDao.queryById(id);
    }

    @Override
    public List<Employee> queryByUsername(String username) {
        return employeeDao.queryByUsername(username);
    }

    @Override
    public boolean addEmployee(Employee employee) {
        int i = employeeDao.addEmployee(employee);
        if(i > 0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean deleteEmployeeById(Integer id) {
        int i = employeeDao.deleteEmployeeById(id);
        if(i > 0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean editEmployee(Employee employee) {
        int i = employeeDao.editEmployee(employee);
        if(i > 0){
            return true;
        }else {
            return false;
        }
    }


}
